<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <ul>
            <li>我需要治疗！！！1</li>
            <li>我需要治疗！！！2</li>
            <li>我需要治疗！！！3</li>
            <li>我需要治疗！！！4</li>
        </ul>
        <ul id="nav">
            <li>啊啊啊！！！1</li>
            <li>啊啊啊！！！2</li>
            <li>啊啊啊！！！3</li>
            <li>啊啊啊！！！4</li>
        </ul>
    </div>
    <script>
        //返回获取元素集合，伪数组存储
        var list = document.getElementsByTagName('li');
        console.log(list);
        console.log(list[0]);
        for(var i = 0; i < list.length; i++){
            console.log(list[i]);
        }

        var nav = document.getElementById('nav');
        var lis = nav.getElementsByTagName('li');
        for(var i = 0; i < lis.length; i++){
            console.log(lis[i]);
        }
    </script>
</body>
</html>